home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 017 / utilprts.arc / UTILSEM.BAT < prev   
DOS Batch File  |  1984-10-18  |  8KB  |  322 lines

  1. bat * utility seminar driver
  2. bat %1 = 0
  3. bat %m = 13
  4. bat -nextpage
  5. bat %1 = %1 + 1
  6. bat call -header
  7. bat call -page%1
  8. bat type | inkey %2
  9. bat if %2 = D exit
  10. bat if %1 <> %m skip 1
  11. fskel
  12. bat if %2 <> E goto -nextpage
  13. c:
  14. ft
  15.  
  16. bat -header cls
  17. bat begtype
  18. ╔════════════════════════════════════════════════════════════════════════════╗\0F
  19. end
  20. bat    type %s%s Utilities Seminar %s%s%s DOS BATCH FACILITY %s%s%s%s Page %1
  21. bat    begtype
  22. ╚════════════════════════════════════════════════════════════════════════════╝
  23.  
  24. end
  25. bat    return
  26.  
  27. bat -page1
  28. bat begtype
  29.                    \0fDOS COMMANDS\07
  30.  
  31. A DOS command is...
  32.  
  33.       How you tell the computer what you want to do.
  34.  
  35. The operating system prompts you for commands with
  36.  
  37.       A>
  38.  
  39. You respond by typing
  40.  
  41.       DIR             to get a list of the files on drive A
  42.       
  43.       123             to execute the spread sheet 123
  44.  
  45.       format b:/s/v   to format a disk on drive B, put the
  46.                          DOS operating system on it, and
  47.                          put an internal label on the disk      
  48. end
  49. bat return
  50.  
  51. bat -page2 begtype
  52.                    \0fDOS COMMANDS\07
  53.  
  54. A DOS command is...
  55.   
  56.       any executable program that can be invoked, including
  57.  
  58.             o    internal DOS commands
  59.             o    programs ending with .EXE
  60.             o    programs ending with .COM
  61.  
  62.       plus
  63.  
  64.             o    A collection of executable programs.
  65.  
  66. A BATCH of executable programs is 
  67.  
  68.             o    A list of things for DOS to do
  69.  
  70.             o    A file identified by the extension .BAT
  71. end
  72. bat return
  73.  
  74. bat -page3
  75. bat begtype
  76.                      \0fBATCH FILES\07
  77.  
  78. Think of a BATCH FILE as
  79.  
  80.       Having stored your keystrokes.
  81.  
  82. You can re-invoke those keystrokes anytime by 
  83.  
  84.       Using the file name.
  85.  
  86. For example, if the file  CHECK.BAT contains in it
  87.  
  88.       astclock
  89.       chkdsk a:
  90.       dir *.com
  91.  
  92. By typing in just "CHECK" all three programs will be executed,
  93. one after the other.
  94. end
  95. bat return
  96.  
  97. bat -page4
  98. bat begtype
  99.                     \0FHOW TO CREATE A BATCH FILE\07
  100.  
  101. Short "quick" and "dirty" files can be created by
  102.  
  103.       Copying the console to a file name.
  104.  
  105. For example, the DOS command
  106.  
  107.       copy con: test.bat<rtn>
  108.       astclock<rtn>
  109.       chkdsk a:<rtn>
  110.       dir *.com<rtn>
  111.       <ctrl-Z><rtn>
  112.  
  113. will create the desired file.
  114.  
  115. To create longer files, however, use any TEXT EDITOR, such as
  116.  
  117.     EDLIN, PERSONAL EDITOR, PEDIT, or WORDSTAR in non-document mode.
  118. end
  119. bat return
  120.  
  121. bat -page5 begtype
  122.                    \0fUSES OF THE BATCH FACILITY\07
  123.  
  124. The batch facility can be used to
  125.  
  126.     o  SIMPLIFY DOS commands
  127.  
  128.     o  Increase PRODUCTIVITY by
  129.  
  130.         o  Reducing keystrokes
  131.  
  132.         o  Reducing human errors
  133.  
  134.         o  Making the computer run unattended
  135.  
  136.     o  Program how the computer INTERACTS with humans.  You can
  137.  
  138.         o  Make the computer easier to use
  139.  
  140.         o  Reduce the amount of knowledge the user needs.
  141. end
  142. bat return
  143.  
  144. bat -page6 begtype
  145.                     \0fEXAMPLE:  KEEP IT SIMPLE!\07
  146.  
  147. INSTALLING AN ELECTRONIC DRIVE
  148.  
  149.                 superdrv c:/u=128/m=130
  150.  
  151. MEANS
  152.       o  Run program SUPERDRV.COM
  153.     o  Set up electronic drive as C
  154.     o  Set aside 128K RAM for user programs
  155.     o  Set aside 130K RAM for electronic disk.
  156.  
  157. PROBLEMS
  158.  
  159.     o  Insists on rigid syntax
  160.     o  Parameters easy to forget
  161.     o  Frequent references to manual
  162.  
  163. SOLUTION          Store above DOS command in file SDRV.BAT.
  164. end
  165. bat return
  166.  
  167. bat -page7 begtype
  168.                    \0fDO IT ALL AT ONCE\07
  169.  
  170. GETTING STARTED WHEN YOU BOOT UP
  171.  
  172.     o  Set time and date
  173.     o  Cause screen to clear after 5 minutes inactivity
  174.     o  Install electronic drive
  175.     o  Copy editor into electronic drive
  176.  
  177. Want all this to happen AUTOMATICALLY when I boot up.
  178.  
  179. SOLUTION      Special BATCH file called AUTOEXEC.BAT.
  180.  
  181. So, create AUTOEXEC.BAT with
  182.  
  183.     astclock
  184.        colblank
  185.      superdrv c:/u=128/m=130
  186.         copy a:pedit.exe c:pe.exe
  187. end
  188. bat return
  189.  
  190. bat -page8 begtype
  191.              \0fREPETITION: PROGRAM-TEST-MODIFY CYCLE\07
  192.                ----------               ----------
  193.                |        | ------------> |        |
  194.                |  EDIT  |               |  TEST  |
  195.                |        | <------------ |        |
  196.                ----------               ----------
  197.  
  198. In developing this seminar presentation, I 
  199.  
  200.     o  Created a file called UTILSEM.BAT
  201.     o  Tested the program UTILSEM
  202.     o  Revised UTILSEM.BAT, based on test results
  203.     o  Re-tested program.
  204.  
  205. To make cycle natural, created two utility files.
  206.  
  207. FT.BAT     pe b:utilsem.bat     UTILSEM.BAT  (went thru seminar)
  208.         b:                                c:
  209.         utilsem                           ft
  210. end
  211. bat return
  212.  
  213. bat -page9 begtype
  214.                   \0fSPECIAL BATCH COMMANDS\07
  215.  
  216. Two types of lines in a batch file:
  217.  
  218.     o  Executable programs
  219.  
  220.     o  Special batch commands.
  221.  
  222.  
  223.             SPECIAL NEEDS                    SOLUTION
  224. -------------------------------------------------------------------------
  225.   o  Put up messages to operator         |  REM, ECHO
  226.                                          |
  227.   o  Wait for operator to do something   |  PAUSE
  228.                                          |
  229.   o  Vary what is executed               |  (variables), IF, GOTO
  230. --------------------------------------------------------------------------
  231.  
  232. Note: ECHO, IF, GOTO are available only in DOS 2.0/2.1, not 1.1.
  233. end
  234. bat return
  235.  
  236. bat -page10 begtype
  237.                 \0fBATCH FILES WITH PARAMETERS\07
  238.  
  239. Suppose you wanted to install the electronic drive, but be able to
  240.  
  241.     o  Vary the amount of memory on the drive.
  242.  
  243. SOLUTION     Invoke with ARGUMENTS or PARAMETERS.  For example
  244.  
  245.                    superdrv c:/u=128/m=%1
  246.  
  247. INVOKE SDRV.BAT by    sdrv 80      WILL GET     superdrv c:/u=128/m=80
  248.  
  249. Another example is invoking a spelling checker, telling it which file:
  250.  
  251.                    PRFPASS1 B:%1
  252.                    PRFPASS2 B:%1c
  253. end
  254. bat return
  255.  
  256. bat -page11 begtype
  257.                    \0fINSTALLATION PROGRAMS\07
  258.  
  259. NEED:  To automate installation of a program.  Steps are
  260.  
  261.     o  Put DOS in left drive and program in right
  262.     o  Transfert DOS system files and BASIC onto program disk
  263.     o  Put appropriate drivers onto program disk for monitor used.
  264.  
  265. SOLUTION: an INSTALL.BAT with printed instructions telling the person to
  266. boot using DOS 2.0, to put the program disk in drive B, to type B: followed 
  267. by return , and to type INSTALL with return.
  268.  
  269. The basic structure of the batch program is
  270.  
  271.     o  Tell the user exactly what to do
  272.         o  Give the user time to do it
  273.     o  When the user is ready, check to see whether done properly
  274.     o  If okay, install; if not, let know and cancel
  275. end
  276. bat return
  277.  
  278. bat -page12 begtype
  279.                 \0fSAMPLE INSTALLATION PROGRAM\07
  280.  
  281. ECHO OFF
  282. ECHO Run this installation program once.
  283. ECHO Please put your DOS 2.0 disk in the left drive A.
  284. PAUSE
  285. IF NOT EXIST A:SYS.COM GOTO QUIT
  286. ECHO Now put your system disk in the right drive B.
  287. PAUSE
  288. IF NOT EXIST B:BARBAIL.EXE GOTO QUIT
  289. A:SYS B:
  290. Copy A:BASICA.COM B:
  291. ECHO To complete installation,
  292. ECHO     enter COLOR if you have a COLOR MONITOR
  293. ECHO     enter MONO  if you have a MONOCHROME MONITOR.
  294. GOTO GOODEX
  295. :QUIT
  296. ECHO Improper disk in drive.
  297. :GOODEX
  298. end
  299. bat return
  300.  
  301. bat -page13 begtype
  302.                    \0FLIMITATIONS\07
  303.  
  304. The BATCH facility built into DOS is limited in what it
  305. can do.  The most serious limitations are that it 
  306.  
  307.     o  Cannot read input from the user
  308.     o  Cannot assign values to variables.
  309.         o  Cannot control or drive .EXE or .COM programs.
  310.  
  311. These limitations are removed in a freeware product called The Extended
  312. Batch Language.  This entire demonstation was written in EBL in one evening.
  313.  
  314. EBL can be gotten free on bulletin boards, or for a contribution of $5 to
  315. its author for software only, or $30 for printed documentation, support, and
  316. updates.  The address is
  317.                           Seaware Corporation
  318.                           P.O. Box 1656
  319.                           Delray Beach, Florida 33444
  320. end
  321. bat return
  322.